/*
* CommonDefinitions.h
*
* Created: 10.02.2013 17:01:26
*  Author: victor
*/


#ifndef COMMONDEFINITIONS_H_
#define COMMONDEFINITIONS_H_

#define ZERO  (u8)0
#define ONE   (u8)1

/*End Of Message for both the HU and CDC is the same (0x014F)*/
#define COMMONDEFINITIONS_C_EOM_U16 0x014F
/* Start Of Message received always from the HU (0x0180)differs from the CDC SOM */
#define COMMONDEFINITIONS_C_HU_SOM_U16 0x0180
/* Define the Time cyclic message*/
#define COMMONDEFINITIONS_C_TIME_U8
/* Enumeration type for the commands supported by BTT module */
typedef enum
{
  PLAY_TRACK_EN = 0,
  PAUSE_TRACK_EN,
  NEXT_TRACK_EN,
  PREVIOUS_TRACK_EN,
  POWER_ON_EN,
  //POWER_OFF_EN,
  FAST_FWD_EN,
  REVERSE_EN,
  SUPPLY_RST_EN,
  PHONE_ANS_HUP_EN,
  ALL_EN
} EN_CommonDefinition_CommandsEnum;
/* Enumeration type for the cyclic messages */
typedef enum
{
  TIME_1s,
  TIME_50ms,
} EN_CommonDefinition_CyclicFlag;

/* High */
#define HIGH (u8)1
/* Low */
#define LOW (u8)0

/*Enumeration for LEDs (input signals)*/
typedef enum
{
  RED_LED_EN = 0,
  GREEN_LED_EN,
  BLUE_LED_EN
} EN_CommonDefinition_LEDsEnum;

/* Type definition for Power status of the BTT module project */
typedef enum
{
  BTT_OFF_EN = 0,
  BTT_ON_EN
} EN_CommonDefinition_PowerStatusEnum;

/* Type definition for Streaming status of the BTT module project */
typedef enum
{
  BTT_PAUSE_EN = 0,
  BTT_PLAY_EN
} EN_CommonDefinition_StreamingStatusEnum;

/* Structure that holds and give access to the bits into a word */
typedef struct
{
	u8 b0_u8 : 1; /*LSB*/
	u8 b1_u8 : 1;
	u8 b2_u8 : 1;
	u8 b3_u8 : 1;
	u8 b4_u8 : 1;
	u8 b5_u8 : 1;
	u8 b6_u8 : 1;
	u8 b7_u8 : 1;
} ST_CommonDefinitions_Bits;

/* Union grants the access to a word at bit level or byte level without performing ALU operations */
typedef union
{
	u8 CommonDefinitions_Byte_u8;
	ST_CommonDefinitions_Bits CommonDefinitions_8Bits;
} UN_CommonDefinitions_Split;

#endif /* COMMONDEFINITIONS_H_ */